# list1 = ['python', 'java', 'golang']
# # 不写下表,弹出列表中的最后一个元素
# list2 = list1.pop()
# print(list2)
# print(list1)
# # #写下标,弹出指定下标元素
# list2 = list1.pop(0)
# print(list2)
# print(list1)
# # clear 清空列表
# # list1.clear
# # print(list1)
# # TODO 通过下标查找元素
# list1 = ['python', 'java', 'javascript', 'golang']
# # 需求: 提出pytnon, javascript
# print(list1[0: 2])
# print(list1[:3])
# print(list1[1:])
# #使用步长
# print(list1[::2])
# #负数
# print(list1[-2:])
# print(list1[-1::-1])
# print(list1[-3::-1])
# print(list1[-1::-1])
# # ""
# # 切片
# 作用:
# 灵活提取列表中的多个元素
# # 特点:
# # 提取后会返回一个新的列表
# # 语法:
# # list[start:end:step]
# # start: 开始下标
# # end: 结束下标(不包括结束位置的元素)
# # step: 步数, 提取的间隔,默认为1. 正数:从左开始提取, 负数: 从右开始提取
# # star/end/step都可以是负数.
# # """
# list1 = ['python', 'java', 'javascript', 'golang', 'c++']
# # TODO 正数
# print(list1[0:2])
# print(list1[:2])
# # 复制当前列表
# print(list1[:])
# # step
# print(list1[::2])
#
# # TODO 负数
# print(list1[-4:])
# print(list1[-5:-2])
# print(list1[-5:-2:-1])
# # TODO list.index(元素)  根据元素获取索引, 获取不到抛出错误
# list1 = ['python', 'java', 'python', 'javascript', 'golang', 'c++']
# # 能够获取到
# # print(list1.index('python'))
# # 不能获取到
# # print(list1.index('js'))
#
# # TODO list.count(元素)  根据元素获取, 元素在列表中出现的次数. 如果元素不存在,返回0
# print(list1.count('python'))
# print(list1.count('java'))
# print(list1.count('js'))
#
# # TODO len(序列) 通用函数, 获取序列的长度
# # list
# print(len(list1))
# # str
# # str1 = 'abcd123'
# # print(len(str1))
#
# list1 = ['python', 'java', 'javascript', 'golang', 'c++', '1']
# # 升序
# list1.sort()
# print(list1)
#
# # 降序
# list1.sort(reverse=True)
# print(list1)
#
# print('--' * 20)
#
# # TODO list.reverse()
# # 列表翻转, 对原列表进行翻转
# list2 = ['python', 'java', 'javascript', 'golang', 'c++', '1']
# list2.reverse()
# print(list2)
#
# # 切片翻转
# list3 = list2[::-1]
# print('切片翻转后:', list3)
# print('原生列表:', li
# list1 = ['python', 'java', ]
# #  列表遍历  while循环 下标
# list1 = ['python', 'java', 'javascript', 'golang', 'c++']
# #          0          1        2            3        4
# # print(list1[0])
# # print(list1[1])
# # print(list1[2])
#
#
# # 循环次数, 静态的数字
# i = 0
# while i < 6:
#     print(list1[i])
#     i += 1
# '''
# # 获取列表的长度
# # print(len(list1))
# i = 0
# while i < len(list1):  # 5
#     print(list1[i])
#     i += 1
# list1 = ['python', 'java', 'javascript', 'golang', 'c++', '1']
# for lost2 in list1:
#     print(lost2)
# # students = [
#     '''['王杰', '尚瑞星', '周昀浩', [['aa', 'bb', [11, 22, 33]]]],
#      ['肖天梅', '刘丹', '李昕霞'] 把每个同学名字打出来'''

#
# students = [['王杰', '尚瑞星', '周昀浩', [['aa', 'bb', 11, 22, 33]]]]
#
# for students1 in students:
#     for students2 in students1:
#         print(students2)
# students = [
#     ['王杰', '尚瑞星', '周昀浩', ['aa', 'bb', [11, 22, 33]],
#      ['肖天梅', '刘丹', '李昕霞']
#      ]
#     print(students[0])
# # # 遍历列表 - 每个同学的名字打印出来
# # or name in students:
# #     for name1 in name:
# #         print(name1)
# # 空元组定义
# # ti = ()
# # t2 = tuple()
# # print(type(ti), ti)
# # print(type(tuple), tuple)
# # t3 = ('hello',)  # 如果元素里只有一个元素, 这个元素后面必须加`逗号`, 不加就不是元组类型
# # t4 = ('a', 1, 1.1, True, [1, 2, 3], None, (11, 12))
# # # print(type(t3), t3)
# # # print(type(t4), t4)
# # t5 =('good',)
# # print(type(t5), t5)
# str1 = 'Hello World'
# # 下标
# print(str1[4])
# print(str1[-1])

# # 切片
# # print(str1[:2])
# # str1 = 'Hello World'
# # i = 0
# # while i < len(str1):
# #     print(str1[i])
# #     i += 1
# #     for n in str1:
# #         print(n)
#
# for r in range(10):
#     print(r)
#
# # for实现1到100的和
#
# o =0
# for zz in range(1,101):
#     o += zz
#     print(o)
#     #for 实现1到100的基数和:
#     o = 0
# for zzz in range(1,101,2):
#     o += zzz
#
# print(o)
# #for 实现1到100的偶数和:
# oo = 0
# for zzx in range(2,101,2):
#     oo += zzx
#     print(oo)

#

